﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using MVCDemo.Models;

namespace MVCDemo.Data
{
    public class DataInitlizer:DropCreateDatabaseIfModelChanges<MVCDemoDb>
    {
        protected override void Seed(MVCDemoDb db)
        {
            db.Users.AddRange(new List<Users>
            {
                new Users
                {
                    Username="admin",
                    Password="113"
                },new Users
                {
                    Username="可怜天下无芳草，天天吃不饱",
                    Password="113"
                },new Users
                {
                    Username="月牙",
                    Password="113"
                },new Users
                {
                    Username="陈桑",
                    Password="113"
                },
            });

            db.Messages.AddRange(new List<Messages>
            {
                new Messages
                {
                    FromUserId=1,
                    Content="明明可以更好的"
                },new Messages
                {
                    FromUserId=2,
                    Content="呀接过"
                },new Messages
                {
                    FromUserId=3,
                    Content="随便啦+1"
                },new Messages
                {
                    FromUserId=4,
                    Content="一天到晚，一天天的。。。"
                },new Messages
                {
                    FromUserId=4,
                    Content="明年会更好"
                },new Messages
                {
                    FromUserId=2,
                    Content="99女儿红"
                },new Messages
                {
                    FromUserId=2,
                    Content="青草"
                },new Messages
                {
                    FromUserId=3,
                    Content="猴儿酒"
                },new Messages
                {
                    FromUserId=1,
                    Content="到处花开"
                },
            });


            db.Comments.AddRange(new List<Comments>
            {
                new Comments
                {
                    FromUserId=1,
                    MsgId=9,
                    Comment="天天想你"
                },new Comments
                {
                    FromUserId=4,
                    MsgId=7,
                    Comment="海纳百川，有容乃大；壁立千仞，无欲则刚。"
                },new Comments
                {
                    FromUserId=3,
                    MsgId=8,
                    Comment="风声雨声读书声，声声入耳；家事国事天下事，事事关心。"
                },new Comments
                {
                    FromUserId=2,
                    MsgId=6,
                    Comment="山川异域，日月同天"
                },new Comments
                {
                    FromUserId=3,
                    MsgId=4,
                    Comment="慈母手中线，游子身上衣"
                },new Comments
                {
                    FromUserId=1,
                    MsgId=1,
                    Comment="小荷才露尖尖角，早有蜻蜓立上头"
                },
            });



            db.SaveChanges();


            base.Seed(db);
        }
    }
}